﻿using ATEDiagnoser;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ATECapybara
{
    public partial class FT_CodeTransfer : Form
    {
        public FT_CodeTransfer()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox1.Text))
            {
                var t = Regex.Match(textBox1.Text.Trim(), @">06[Ss]([0-9a-zA-Z]+)1[Pp]([0-9]+)");
                if (t.Success)
                {
                    textBox2.Text = t.Groups[1].Value;
                    textBox3.Text = t.Groups[2].Value;
                    if (autocopy.Checked)
                    {
                        if (!string.IsNullOrEmpty(textBox2.Text))
                        {
                            Clipboard.SetDataObject(textBox2.Text);
                        }
                    }
                }
                else
                {
                    textBox2.Text = "";
                    textBox3.Text = "";
                }
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void common_MouseDown(object sender, MouseEventArgs e)
        {
            var tb = sender as TextBox;
            if (!string.IsNullOrEmpty(tb.Text))
            {
                tb.SelectAll();
            }
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
